/**
 *
 * 医疗服务指标点击模块
 * @Date: 2016-1-25
 * @author: Jackson wang
 * @version: 1.0
 * @since: 1.0
 *
 */
 
 define(["jquery","sysmanMain","valueUtil","baseMedical","antiMedical","antiDose","overlayPrescribe","basePatient","tabServ"],
		function($,sysmanMain,valueUtil,baseMedical,antiMedical,antiDose,overlayPrescribe,basePatient,tabServ) {
	
			
	var config = {
		//dom根节点
		rootid : 'panel-chart-all div.medical-panel',
		
		//事件dom选择器
		selector: 'a.medical-indicate'
		
		
	}	
	
	var public_method = {
		
		/**
		 * @param _options.evt	事件对象
		 * @param _options.yearAndMonth	统计年月
		 */
		openPage:function(_options){
			if(window.console){
				console.info('dutiesIndicate loaded and running ...')
			}
			var e = _options.evt
			if(e && e.currentTarget){
				var _t = e.currentTarget
				var _c = $(_t).attr('indicate');
				
				var oc = {
					monitor_year_month:_options.yearAndMonth,
					data_type:'2',
					patient_type:'1'
				}
				
				var ic = {
					monitor_year_month:_options.yearAndMonth,
					data_type:'2',
					patient_type:'2'
				}
				if(_c){
					switch(_c){
						case 'duties-num':
						//门诊人次
						_url = '/dutiesStatistic/query/mainPage.action',
						private_method.openTab({pageURL:_url,name:'职能监控统计'});
						break;
						case 'inpatient-out-num':
						//出院人次
						private_method.openBaseInPatient(ic);
						break;
						case 'outpatient_count_money':
						//门诊收入
						private_method.openBasePatient(oc);
						break;
						case 'inpatient_out_count_money':
						//出院病人收入
						private_method.openBaseInPatient(ic);
						break;
						case 'base-medical-outpatient':
						//门诊基药金额比例
						
						private_method.openBaseMedical(oc);
						
						break;
						case 'base-medical-inpatient':
						//住院基药金额比例
						private_method.openBaseMedical(ic);
						break;
						case 'outpatient-anti-use':
						//门诊抗菌药品使用率
						private_method.openAntiUse(oc);
						break;
						
						case 'inpatient-anti-use':
						//住院抗菌药物使用比例
						private_method.openAntiUse(ic);
						break;
						
						case 'inpatient-ddd':
						//出院患者抗菌药物使用强度
						private_method.openAntiDose(ic);
						break;
						
						case 'overlay-prescribe':
						//超限处方
						private_method.openOverlayPrescribe(oc);
						break;
						
						case 'overlay-inpatient':
						//大额住院费用
						private_method.openOverlayInpatient(ic);
						break;
						default:
						private_method.openOutpatientNum();
					}
				}
			}
		}
	}
	
	var private_method = {
		openOutpatientNum:function(_options){
			
		},
		openBaseMedical:function(_options){
			baseMedical.openPage(_options)			
		}
		,
		openAntiUse:function(_options){
			antiMedical.openPage(_options)
		},
		openAntiDose:function(_options){
			antiDose.openPage(_options)
		}
		,
		openOverlayPrescribe:function(_options){
			overlayPrescribe.openPage(_options)
		}
		,
		openBasePatient:function(_options){
			basePatient.openPage(_options)
		}
		,
		openBaseInPatient:function(_options){
			basePatient.openInpatientPage(_options)
		},
		
		openTab:function(_config){
					var _url,_text,rootPath
					
					rootPath = '/'+ sysmanMain.getRootPath();
					
					if(_config.pageURL && _config.name){
						_url = _config.pageURL;
						_text = _config.name?$.trim(_config.name):null
					
						if(_text && _text.length>0){
							//保存当前tab页							
							var _options = {
								target : 'centerTabs',
								title : _text,
								tabUrl : rootPath+_url,
								tools : []
							};
							if (_url) {
			//					tabServ.addFrameTab(_options);
								tabServ.addHrefTab(_options)
							}
						}
					}
				}
	}
	return public_method;
})